UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rws/ne28gG1S6b3K8KEgxc4x2lOagyCd4NA/YRqJ1Rc=' 
WHERE 
  key_id = 'fa6a8109ba987730bef61499d42c8e4c15307bceba89e00baaafcc8123614c85' 
  AND (
    token = 'Rws/ne28gG1S6b3K8KEgxc4x2lOagyCd4NA/YRqJ1Rc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046