UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p7DDO75k1P84pxwf7AZBxKVxA+Wphvq5DLUbTvGCIfM=' 
WHERE 
  key_id = '4d0a51256254b9ec687a412577dcf8806ae08a6986501139e7855964923ab1d9' 
  AND (
    token = 'p7DDO75k1P84pxwf7AZBxKVxA+Wphvq5DLUbTvGCIfM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030