UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YEYaheVxSvoDZHbCCgSDAmQLoQ9ypl4iYsAXeNQqs5c=' 
WHERE 
  key_id = '7ce32734a45dda2bf05c895c6d1b1ab5642eaebf74250c2a953dd018b0fca3c9' 
  AND (
    token = 'YEYaheVxSvoDZHbCCgSDAmQLoQ9ypl4iYsAXeNQqs5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054