UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/QlYqzL9yfT+urp+rIJCTXSxaN/z6hhWDIGucavzkBA=' 
WHERE 
  key_id = '9ac4bd9f665de249058bb6fbcc101ea04191990eecfa7e422255faabe9af819f' 
  AND (
    token = '/QlYqzL9yfT+urp+rIJCTXSxaN/z6hhWDIGucavzkBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040