UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lRTb6uDSww9Y524X30E4IV0sTp7LdVDjex20Z+uxC7o=' 
WHERE 
  key_id = 'ec5e421f52d62208025500dd2f25d46eef31f8120ade1d8d7d8b7c4972dd3db7' 
  AND (
    token = 'lRTb6uDSww9Y524X30E4IV0sTp7LdVDjex20Z+uxC7o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026