UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PjbX4+k/xHC1GkvbC9mHxY7HDy3038BAim0vFsSTVuk=' 
WHERE 
  key_id = '02e255366ae3b23c507c31c1078588b3d6c7ada55289b700037b45a876e3b619' 
  AND (
    token = 'PjbX4+k/xHC1GkvbC9mHxY7HDy3038BAim0vFsSTVuk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038