UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2ditcxllZRQY1FCQgpEzXELkAKJ73sB8d2egc+mgNXo=' 
WHERE 
  key_id = 'ca69b04a897d73d073f3976668728be0f200b01b001703ab252be7c0ee1398bd' 
  AND (
    token = '2ditcxllZRQY1FCQgpEzXELkAKJ73sB8d2egc+mgNXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035