UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'embFSOVbplG2AUpPhbPxs5DArMPVI7bqsW56IvtAEfc=' 
WHERE 
  key_id = 'eccabc0ee8978af24e95fa26cce4de9c0acfd7e7a3a2ee31e4eb023ff9ee1ebc' 
  AND (
    token = 'embFSOVbplG2AUpPhbPxs5DArMPVI7bqsW56IvtAEfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053