UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XBsbo1NxIxfFyNbdBS8xQfGF4afiAfECEZI8z6R0cGg=' 
WHERE 
  key_id = '6f37d5887e7d8701cc84387d3d67a9e184191716029f68b6032d1df52f2e709f' 
  AND (
    token = 'XBsbo1NxIxfFyNbdBS8xQfGF4afiAfECEZI8z6R0cGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033