UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l4ADe6fTT60r7oPySkxbHVnB0UaCs92FoD7obeXggPo=' 
WHERE 
  key_id = '436f32d4c1d4ec9c10d79ed02093888cf7a87de4ae13d60604628234b6ec830e' 
  AND (
    token = 'l4ADe6fTT60r7oPySkxbHVnB0UaCs92FoD7obeXggPo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036