UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bN3GfMy6IdQqqZsDG1aZsHtTRYFWr9JpxrxSNsFjW5o=' 
WHERE 
  key_id = '477a0b7f66f18c63ab75764993776a4107d9dcab9c01ed0a81589dd408e683cf' 
  AND (
    token = 'bN3GfMy6IdQqqZsDG1aZsHtTRYFWr9JpxrxSNsFjW5o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065