UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HqBWHFyQbIcY5eSJypRX9DWueN/fxXPMLfxVv5o8Vdk=' 
WHERE 
  key_id = '237881bec8060f7a86c8d6032c7800a0fea7ab81830b98146eb784d3ac1f29a5' 
  AND (
    token = 'HqBWHFyQbIcY5eSJypRX9DWueN/fxXPMLfxVv5o8Vdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027