UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qjbS30z1t1cUusisuoD+xkId0kMkN5mV4ZA5+UMtuB0=' 
WHERE 
  key_id = '19a7d7b8938a4ddf028c8dc7a1205b3764bcb30f7119c8024c804d9878d262b5' 
  AND (
    token = 'qjbS30z1t1cUusisuoD+xkId0kMkN5mV4ZA5+UMtuB0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033