UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tw72k4LLXWLxLu/TkOanBZxntFP2mEoezg3+jSIz8No=' 
WHERE 
  key_id = 'c99e8e0f254b89d79490ee49cbdf1abef9d77b45d382a3ec92a6626575537073' 
  AND (
    token = 'tw72k4LLXWLxLu/TkOanBZxntFP2mEoezg3+jSIz8No=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061