UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F2SpDwlvOhy5zEx7fPE6ARt7990lCEgdjBEU7F/lR1k=' 
WHERE 
  key_id = '6418d3e570b9a3e4f678e41a312a588a46e03a2ee6d49e78a241c16970b76718' 
  AND (
    token = 'F2SpDwlvOhy5zEx7fPE6ARt7990lCEgdjBEU7F/lR1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026