UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lhj9E7u1veGBG6ZzI1BVZ9Do2wUbeDEXmazEiZS41eE=' 
WHERE 
  key_id = '34d69cf6f3836ee884e47e7e5451fd371a6fe618b6e37bd35d0eb9765993823c' 
  AND (
    token = 'lhj9E7u1veGBG6ZzI1BVZ9Do2wUbeDEXmazEiZS41eE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037