UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YIMz2V+cNUP8mwyrLDWACKusMyO33L1Ljk2yzoK78Sg=' 
WHERE 
  key_id = '27f53cde284a75e4cceb971bd8db70e6755b03f8d617545cdc4a874336742278' 
  AND (
    token = 'YIMz2V+cNUP8mwyrLDWACKusMyO33L1Ljk2yzoK78Sg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034