UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CcbQvZSsOOeAnDItgotAJo2VxsfL6r0kI2CyJ4Uo8ZU=' 
WHERE 
  key_id = '4faa3025d975b6e772a5474dcc2ac82cfc8fd2ad9787bd071df36c5511dada65' 
  AND (
    token = 'CcbQvZSsOOeAnDItgotAJo2VxsfL6r0kI2CyJ4Uo8ZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038