UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rxaSb40V7mIAapv56HuTJ8o4gOrGX2Relqztbk+hzt4=' 
WHERE 
  key_id = '5a23fd9fa3977eab4f34f8fb9a6270b23c8da588883c785c0b74de8c55f06343' 
  AND (
    token = 'rxaSb40V7mIAapv56HuTJ8o4gOrGX2Relqztbk+hzt4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00094