UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hXCjzsPfsxXz/dyNebI+VGOLSz1oa6MRtAFvbZiq3lY=' 
WHERE 
  key_id = 'b8898160c955367bda67f17a9df5cf54601cf55066a886d3aba44020fdaced91' 
  AND (
    token = 'hXCjzsPfsxXz/dyNebI+VGOLSz1oa6MRtAFvbZiq3lY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036