UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cM1Afph1DW+bVp8UYLSyxTOW0L3lzjP0rdI9ZIFIrW4=' 
WHERE 
  key_id = 'b82f1d5280eb5bf31fbebad72f06465b54aef86251b8e81fb27656243724ec65' 
  AND (
    token = 'cM1Afph1DW+bVp8UYLSyxTOW0L3lzjP0rdI9ZIFIrW4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017