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

Query time 0.00030