UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MQxfX0tq+gMYup0MdyypanlAgICKUsIFxmabk7cq9J8=' 
WHERE 
  key_id = '82c6081fa98145964c673c350e6115e75fcc211f1593104d8739a5443e3943c4' 
  AND (
    token = 'MQxfX0tq+gMYup0MdyypanlAgICKUsIFxmabk7cq9J8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041