UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0OfxCcwiLCnuy0SQxuwR14n/4+mKJumIzRGKWldgWLk=' 
WHERE 
  key_id = 'd580d3ffe2e20dda1d876fef58f28e4585edd97f5928a32473d23ae8882c14d3' 
  AND (
    token = '0OfxCcwiLCnuy0SQxuwR14n/4+mKJumIzRGKWldgWLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068