UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XZJDBc4dfDQKxbw9Ln35httDD4FAKEu2RcSM0vR+Zho=' 
WHERE 
  key_id = '9bdc49478648e47f8325ca346d8916cf0ce89e382fea041ab2933ce41c078916' 
  AND (
    token = 'XZJDBc4dfDQKxbw9Ln35httDD4FAKEu2RcSM0vR+Zho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031