UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yGeJF59Eqoa4z4DXJ3KvuNQh1vpRUZESnVytTPiO7Uo=' 
WHERE 
  key_id = 'c8d91012d4200e3b31931429018c5b087fc63f68f168499267509970963d42d5' 
  AND (
    token = 'yGeJF59Eqoa4z4DXJ3KvuNQh1vpRUZESnVytTPiO7Uo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040