UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fsisbRphUErVdq5s63INl0p8ASXSftOZgN1yJbPTQIQ=' 
WHERE 
  key_id = 'b23b2bf62696c7eace088faa3400430b020acfc5e0681a44ddf0fd295be523f1' 
  AND (
    token = 'fsisbRphUErVdq5s63INl0p8ASXSftOZgN1yJbPTQIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044